package behaviours.inventor;

import behaviours.curator.*;
import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
import jade.domain.DFService;
import jade.domain.FIPAException;
import jade.domain.FIPAAgentManagement.DFAgentDescription;
import jade.domain.FIPAAgentManagement.Property;
import jade.domain.FIPAAgentManagement.ServiceDescription;

public class RegisterService extends OneShotBehaviour {

	public RegisterService(Agent agent) {
		super(agent);
	}

	@Override
	public void action() {
		DFAgentDescription dfd = new DFAgentDescription();
        dfd.setName(myAgent.getAID());
        
        ServiceDescription service = new ServiceDescription();
        service.setName("inventor");
        service.setType("get inventory information");
        service.addProperties(new Property("Name", "Inventor"));
        dfd.addServices(service);
        try {
			DFService.register(myAgent, dfd);
		} catch (FIPAException e) {
			throw new RuntimeException(e);
		}
	}

}
